<template>
	<view class="content">
		<view class="wid100" :style="'background-image: url('+url+'/addon/qianyu_petrol/wxapp/image/ygrk.png'"
		style="box-sizing: border-box;background-size: 100% 100%;height: 500rpx;">
			<view style="height: 152rpx;"></view>
			<view class="textCen coFFF fowe800" style="font-size: 73rpx;">欢迎登录</view>
		</view>
		<view style="height: 90rpx;"></view>
		<view class="mar dis disAl borRad40" style="width: 542rpx;height: 70rpx;background-color: #EEEEEE;">
			<view class="dis disAl disJuC" style="width: 96rpx;">
				<image src="../../static/shoujihao.png" style="width: 30rpx;height: 42rpx;"></image>
			</view>
			<input class="foSi25 fowe600" style="width: 446rpx;"
				v-model="phone" type="text" placeholder="请输入输入手机号" placeholder-style="color: #8F8F8F;"/>
		</view>
		<view class="mar dis disAl borRad40" style="width: 542rpx;height: 70rpx;background-color: #EEEEEE;margin-top: 50rpx;">
			<view class="dis disAl disJuC" style="width: 96rpx;">
				<image src="../../static/mima.png" style="width: 30rpx;height: 42rpx;"></image>
			</view>
			<input class="foSi25 fowe600" style="width: 446rpx;"
				v-model="password" password type="text" placeholder="请输入密码" placeholder-style="color: #8F8F8F;"/>
		</view>
		<view class="dis disAl disJuC foSi30 coFFF borRad40 mar" @click="denglu"
			style="margin-top: 171rpx;width: 542rpx;background-color: #37BCC3;height: 70rpx;">登录</view>
		<view class="dis disAl disJuC mar-top30 foSi20" style="color: #747474;line-height: 30rpx;" @click="xuan = !xuan">
			<view v-if="xuan" class="dis disAl disJuC borRad50" style="width: 20rpx;height: 20rpx;border: 1rpx solid #37BCC3;">
				<view class="borRad50" style="width: 12rpx;height: 12rpx;background-color: #37BCC3;"></view>
			</view>
			<view v-if="!xuan" class="dis disAl disJuC borRad50" style="width: 20rpx;height: 20rpx;border: 1rpx solid #818181;"></view>
			<view class="mar-left10">我已阅读并同意
			<span @click="tiaozhuan1('/pages/common/richtext?title=用户协议&type=0')" style="color: #37BCC3;">《用户协议》</span>和
			<span @click="tiaozhuan1('/pages/common/richtext?title=隐私协议&type=1')" style="color: #37BCC3;">《隐私协议》</span></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				phone: '',
				password: '',
				xuan: false
			}
		},
		onLoad() {
		},
		methods: {
			denglu() {
				var that = this;
				if(!that.xuan){
					return uni.showToast({title: '请输入勾选协议',icon: 'error',duration: 2000})
				}
				if(!that.phone){
					return uni.showToast({title: '请输入输入手机号',icon: 'error',duration: 2000})
				}
				if(!that.password){
					return uni.showToast({title: '请输入密码',icon: 'error',duration: 2000})
				}
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_clerk_login',
					method: "POST",
					header: {
						'site-id': that.global.site_id,//自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						mobile: that.phone,
						password: that.password
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							uni.setStorageSync('yuan_userinfo', result.data);
							that.tiaozhuan('/pages/shop/workbench')
						}else{
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 1000
							});
						}
					}
				})
			},
			tiaozhuan(url){
				uni.redirectTo({
					url: url
				})
			},
			tiaozhuan1(url){
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.content {
		background: #F6F9FE;
		height: 100vh;
	}

</style>
